{% block ionosphere_performance_block %}
<!-- BEGIN /ionosphere?performance=true block -->
{% if print_debug == 'True' %}
<code> DEBUG </code> :: ionosphere_performance block</br>
{% endif %}

{% if display_message %}
<code> ERROR </code></br>
<code> message </code>: {{ display_message }}<br>
{% endif %}

<div class="navbar-header" role="navigation">
  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
  </button>
		<ul class="nav nav-tabs" role="view_tablist" id="view">
		  <li><a href="/ionosphere"><span class="logo"><span class="sky">Training</span> <span class="re">data</span></span></span></a></li>
		  <li class="active"><a href="?fp_view=true"><span class="logo"><span class="sky">Features</span> <span class="re">profiles</span></span></span></a></li>
		</ul>
		<div class="tab-content">
	  	<div class="tab-pane active" id="view">
	<br>
  <div class="navbar-header" role="navigation">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
      <span class="sr-only">Toggle navigation</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </button>
  </div>

<!--	<div class="col-md-9 col-md-pull-3"> -->
	<div class="col-md-12">
		<ul class="nav nav-tabs" role="tablist" id="list_by-tabs">
		  <li><a href="?fp_search=true&metric=all&limit=10&order=DESC">Search</a></li>
		  <li><a href="?fp_matches=true&metric=all&limit=0&from_timestamp={{ matched_from_datetime }}&order=DESC">Matches</a></li>
		  <li><a href="?fp_validate=true&metric=all">Validate</a></li>
		  <li class="active"><a href="?performance=true">Performance</a></li>
		  <li><a href="/ionosphere?fp_view=true">List by metrics</a></li>
		  <li><a href="?fp_view=true&a_dated_list=true">List by date</a></li>
		</ul>
		<div class="tab-content">

  		<div class="col-md-12">
<!--  		<div class="container"> -->
  		  <h4><span class="logo"><span class="sky">Performance ::</span> <span class="re">features profiles and layers</span></span></span></h4>
  {% if performance_results %}
        <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#search_options">Show search options</button>
        <div id="search_options" class="collapse">
  {% endif %}
        <form action="ionosphere">
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Search criteria</th>
  		        <th>filter</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Performance</td>
  		        <td><select name="performance">
                <option value="true">true</option>
              </select></td>
  		      </tr>
  		      <tr>
  		        <td>metric:</td>
  		        <td><input type="text" name="metric" value="all" /> Metric name (if one is desired)</td>
  		      </tr>
  		      <tr>
  		        <td>remove prefix:</td>
  		        <td><input type="text" name="remove_prefix" value="false" /> Remove the prefix from the metric name (do not include the final dot) e.g. <code>telegraf</code></td>
  		      </tr>
  		      <tr>
  		        <td>Metric like</td>
  		        <td><input type="text" name="metric_like" value="all"> (wildcards are MySQL LIKE style, % e.g. stats.app.requests.http_status_codes.% or %.http_status_codes.%)</td>
  		      </tr>
  		      <tr>
  		        <td>from_timestamp</td>
  		        <td><input type="text" name="from_timestamp" value="all"> (unix timestamp or %Y%m%d %H:%M)</td>
  		      </tr>
  		      <tr>
  		        <td>until_timestamp</td>
  		        <td><input type="text" name="until_timestamp" value="all"> (unix timestamp or %Y%m%d %H:%M)</td>
  		      </tr>
  		      <tr>
  		        <td>period</td>
              <td><select name="period">
                <option value="daily">daily</option>
                <option value="weekly">weekly</option>
                <option value="monthly">monthly</option>
              </select> Period</td>
  		      </tr>
  		      <tr>
  		        <td>timezone</td>
              <td><select name="tz">
                <option value="UTC">UTC</option>
                {% for item in pytz_timezones %}
                <option value="{{ item }}">{{ item }}</option>
                {% endfor %}
              </select></td>
  		      </tr>

  		      <tr>
  		        <td>anomalies</td>
              <td><select name="anomalies">
                <option value="true">true</option>
                <option value="false">false</option>
              </select> Show anomalies</td>
  		      </tr>
  		      <tr>
  		        <td>new_fps</td>
                <td><select name="new_fps">
                  <option value="true">true</option>
                  <option value="false">false</option>
                </select> Show new feature profiles count per period</td>
  		      </tr>
  		      <tr>
                <td>total_fps</td>
                <td><select name="total_fps">
                  <option value="false">false</option>
                  <option value="true">true</option>
                </select> Show total feature profiles count for entire period</td>
  		      </tr>
<!--  		      <tr>
                <td>fp_type</td>
                <td><select name="fp_type">
                  <option value="all">all</option>
                  <option value="user">user generated</option>
                  <option value="learnt">learnt</option>
                </select> Show all or user generated or learnt features profiles in the above fps contexts</td>
  		      </tr>
-->
  		      <tr>
                <td>fps_matched_count</td>
                <td><select name="fps_matched_count">
                  <option value="false">false</option>
                  <option value="true">true</option>
                </select> Show feature profiles match count</td>
  		      </tr>
  		      <tr>
                <td>layers_matched_count</td>
                <td><select name="layers_matched_count">
                  <option value="false">false</option>
                  <option value="true">true</option>
                </select> Show layers match count</td>
  		      </tr>
  		      <tr>
                <td>sum_matches</td>
                <td><select name="sum_matches">
                  <option value="true">true</option>
                  <option value="false">false</option>
                </select> Sum features profile and layers match count</td>
  		      </tr>
  		      <tr>
  		        <td>title</td>
  		        <td><input type="text" name="title" value="default" /> If default the metric name or metric wildcard name will be used or use none for no title</td>
  		      </tr>
  		      <tr>
  		        <td>format</td>
                <td><select name="format">
                  <option value="normal">normal</option>
                  <option value="json">json</option>
                </select> Select normal for a query on the web page or json for a json response</td>
  		      </tr>
  		      <tr>
              <td>width</td>
              <td><input type="number" name="width" min="2" max="20" value="8"> plot width</td>
    		     </tr>
  		      <tr>
              <td>height</td>
              <td><input type="number" name="height" min="1" max="20" value="4"> plot height</td>
    		     </tr>
  		    </tbody>
  		  </table>
        <br>
        <input type="submit" value="Performance">
      </form>
  {% if performance_results %}
<!-- collapse button div -->
      </div>
	  <h4><span class="logo"><span class="sky">Performance ::</span> <span class="re">analysis complete ::</span></span></span> OK</h4>
    {% if performance_results['success'] %}
	  <div class="alert alert-success">
	    <strong>Success!</strong>
	  </div>
    {% else %}
	  <div class="alert alert-warning">
	    <strong>No results</strong> - {{ performance_results['reason'] }}
	  </div>
    {% endif %}
    {% if performance_results['plot'] %}
    <img src="ionosphere_images?image={{ performance_results['plot'] }}" alt="{{ for_metric }} Ionosphere performance">
    <br>
    {% endif %}


    <br>
	  <h4><span class="logo"><span class="sky">Performance ::</span> <span class="re">data ::</span></span></h4>
		  <table class="table table-hover">
		    <thead>
		      <tr>
		        <th>Item</th>
		        <th>Data</th>
		      </tr>
		    </thead>
		    <tbody>
		      <tr>
		        <td>csv file</td>
		        <td><a href="/ionosphere_file?file={{ performance_results['csv'] }}">{{ performance_results['csv'] }}</a></td>
		      </tr>
		      <tr>
		        <td>plot file</td>
		        <td>{{ performance_results['plot'] }}</td>
		      </tr>
		        <td>json</td>
		        <td>{{ performance_json_dict }}</td>
		      </tr>
		    </tbody>
		  </table>
  {% endif %}
      </div>
    </div> <!-- END div class="col-md-12" -->

	</div>
	</div>
	</div>
  </div>
</div>
</div>
</div>
</div>
</div>

<!-- END /ionosphere?performance=true block -->
{% endblock %}
